<?php

class Story_Widget_CreateScriptsPlayController extends
    Engine_Content_Widget_Abstract
{
    public function indexAction()
    {
    	$story = null;
    	if( Engine_Api::_()->core()->hasSubject() ) {
    		$story = Engine_Api::_()->core()->getSubject();   		 
    		
    		
    		if(!$story->canView(Story_Model_Category::SCRIPT_PLAY)){
    			return $this->setNoRender();
    		}    		
    	}
    	
        $viewer = Engine_Api::_()->user()->getViewer();
        $this->view->can_create = Engine_Api::_()->authorization()->isAllowed('story', $viewer, 'create');

        if (!$this->view->can_create) {
            return $this->setNoRender();
        }
        
        $this->view->form = new Story_Form_Create_Custom(array(
                'category' => Story_Model_Category::SCRIPT_PLAY,
                'tit' => 'Scripts and Play',
                ));
    }

}
